/// @tags:
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <numeric>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

using ll = long long;

constexpr int maxn = 1e2;

char str[maxn];

int main() {
  cin >> str;
  int n = strlen(str);
  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    ans = ans * 26 + str[i] - 'A' + 1;
  }
  cout << ans;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("C - abc285_brutmhyhiizp.in", "r", stdin);
  freopen("C - abc285_brutmhyhiizp.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
